/************************************************************************
 * @file StandardMenuManager.cpp
 * @author Ian Chen
 * @version 1.0
 *
 * @section LICENSE
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 3 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
 * General Public License for more details at
 * http://www.gnu.org/licenses/lgpl.html
 *
 ************************************************************************/
#include <pluginui/manager/spi/StandardMenuManager.h>

namespace antu
{
namespace plugin
{
namespace ui
{
StandardMenuManager::StandardMenuManager(QMenuBar* pBar)
    : AbstractMenuManager(),
      m_pMenuBar(pBar)
{
    Q_ASSERT(m_pMenuBar != nullptr);
}

QMenu *StandardMenuManager::createMenu(const QString& name, const QString &title, const QIcon &icon)
{
    QMenu* pMenu = nullptr;
    if (!icon.isNull())
    {
        pMenu = this->m_pMenuBar->addMenu(icon, title);
    }
    else
    {
        pMenu = this->m_pMenuBar->addMenu(title);
    }
    pMenu->setObjectName(name);
    return pMenu;
}
}
}
}
